﻿using Newtonsoft.Json;
using System.Collections.Generic;

namespace AutomationCommand
{
    public class wb_elmt_wit : BasiCommand
    {
        [JsonProperty("ned_dip")]
        public int NeededDip { get; set; }

        [JsonProperty("by_type")]
        public string ByType { get; set; }

        [JsonProperty("by_content")]
        public string ByContent { get; set; }

        [JsonProperty("checklist")]
        public List<ChecklistItem> Checklist { get; set; }

        [JsonProperty("ck_attribute")]
        public string CheckAttribute { get; set; }

        [JsonProperty("ck_value")]
        public string CheckValue { get; set; }

        [JsonProperty("sql")]
        public SqlConfig Sql { get; set; }

        [JsonProperty("overtime")]
        public int Overtime { get; set; }

        public wb_elmt_wit()
        {
            FunctionType = "wb_elmt_wit";
            OtherName = "元素确认";
            SuccessJump = -1;
            FailureJump = -1;
            NeededDip = 0;
            ByType = "";
            ByContent = "";
            Checklist = new List<ChecklistItem>();
            CheckAttribute = "";
            CheckValue = "";
            Sql = new SqlConfig();
            Overtime = 0;
        }

        public bool Execute()
        {
            // 在这里编写执行命令的逻辑
            // 返回执行结果
            return true; // 假设此处始终成功
        }
    }

    public class ChecklistItem
    {
        [JsonProperty("type")]
        public string Type { get; set; }

        [JsonProperty("content")]
        public string Content { get; set; }

        [JsonProperty("atb")]
        public string Attribute { get; set; }

        [JsonProperty("key")]
        public string Key { get; set; }

        [JsonProperty("jump")]
        public long Jump { get; set; }
    }

    public class SqlConfig
    {
        [JsonProperty("nd")]
        public int ND { get; set; }

        [JsonProperty("tn")]
        public string TN { get; set; }

        [JsonProperty("fn")]
        public string FN { get; set; }
    }
}
